package com.wise.service.portal.content.applicationcolumns;

import com.wise.entities.content.ApplicationColumn;
import com.wise.framework.dao.SqlSelect;
import com.wise.framework.daomodel.DaoList;
import com.wise.model.content.enums.ArticleColumnShowStatus;
import com.wise.summer.v1.portal.content.applicationcolumns.ListApplicationColumns;
import org.springframework.stereotype.Service;
import org.summerframework.model.SummerService;
import org.summerframework.model.SummerServiceBean;

import java.util.List;

/**
 * @author hejiawei
 * @date 2020/10/27 12:49
 */
@Service
@SummerService
public class ListApplicationColumnsService implements SummerServiceBean<ListApplicationColumns> {
    @Override
    public void sum(ListApplicationColumns model) {
        SqlSelect sql = SqlSelect.selec("*")
                .fromClassName(ApplicationColumn.class)
                .eq(ApplicationColumn._showState, ArticleColumnShowStatus.SHOW.value())
                .eqLang(ApplicationColumn._lang)
                .order_by(ApplicationColumn._sort)
                .order_by(ApplicationColumn._id + " desc");
        List<ListApplicationColumns.Result> articleColumnList = DaoList.s(ListApplicationColumns.Result.class, sql);
        model.setSummerResult(articleColumnList);
    }
}
